<?php
require_once("../../config/config.inc.php");
$SM->assign("header_ext",true);

$sAction      = fn_getParam("strAction","");
$sProjectID   = fn_getParam("strProjectID","");
$isEnableEdit = true;

$aDefaultWeek = "0111110"; //from sunday to saturday.
$aDefaultTime = array("AM_START_TIME"=>"09:00","AM_END_TIME"=>"12:00",
    "PM_START_TIME"=>"13:00","PM_END_TIME"=>"18:00");

$SM->assign("aSECURITY",$DICT->getComboStore("BASE_SECURITY",false));
$SM->assign("sSECURITY",($SEC->sRole == RIGHT_ADMIN ? "3" : "5"));
$SM->assign("aImportance",$DICT->getComboStore("BASE_IMPORTANCE",false));
$SM->assign("sDefaultManager",$SEC->sUserName);
$SM->assign("aDefaultWeek",$aDefaultWeek);
$SM->assign("aDefaultTime",$aDefaultTime);
$SM->assign("sProjectID",$sProjectID);

$aManager = "['','未确定']";
if ($SEC->sRole == RIGHT_ADMIN && $isEnableEdit) { //获取负责人列表
    $sql = "SELECT USERNAME,TRUENAME FROM $TABLE_EP_USER ";
    $sql.= "WHERE EPID='".$SEC->sCorpCD."' ";
    $sql.= "ORDER BY TRUENAME";
    $stmt= $DB->query($sql);
    while ($row = $DB->fetchRow($stmt)) {
        $aManager .= ",['".$row["USERNAME"]."','".$row["TRUENAME"]."']";
    }
    $DB->freeResult($stmt);
} else {
    $aManager .= ",['".$SEC->sUserName."','".$SEC->sTrueName."']";
}
$SM->assign("aManager","[".$aManager."]");
$SM->assign("isEnableEdit",($isEnableEdit?"":"disabled"));

$SM->display('task/project.html');
?>